Skip to content

Keep a comment after the of keyword of a union case - #3502

Merged
nojaf merged 2 commits into
fsprojects:mainfrom
nojaf:fcs-of-keyword
Sep 25, 2026
Merged

nojaf merged 2 commits into
fsprojects:mainfrom
nojaf:fcs-of-keyword

Conversation

@nojaf

@nojaf nojaf commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

The syntax tree had no range for the of keyword of a union case or exception. The keyword was printed as plain text, so a block comment after it, as in exception E of (*name*) string, was attached to the case name and moved in front of of.

Update FCS to 'Record the range of the of keyword in SynUnionCaseTrivia', commit 5e9647f158fe282462aba57ed83ada910a91b90e, which adds that range to SynUnionCaseTrivia. UnionCaseNode now has an OfKeyword node built from it, so a comment attaches to the side of the keyword it was written on. The wordOf helper is no longer used and is removed.

Fixes #1959

The syntax tree had no range for the `of` keyword of a union case or
exception. The keyword was printed as plain text, so a block comment
after it, as in `exception E of (*name*) string`, was attached to the
case name and moved in front of `of`.

Update FCS to 'Record the range of the `of` keyword in
SynUnionCaseTrivia', commit 5e9647f158fe282462aba57ed83ada910a91b90e,
which adds that range to SynUnionCaseTrivia. UnionCaseNode now has an
OfKeyword node built from it, so a comment attaches to the side of the
keyword it was written on. The wordOf helper is no longer used and is
removed.

Fixes fsprojects#1959
@nojaf
nojaf merged commit 03957d1 into fsprojects:main Sep 25, 2026
6 checks passed
@nojaf
nojaf deleted the fcs-of-keyword branch September 25, 2026 14:26
This was referenced Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong change of comment's position

1 participant